load("//tools:defaults.bzl", "ng_module", "ng_test_library", "ng_web_test_suite", "sass_binary", "sass_library")

package(default_visibility = ["//visibility:public"])

ng_module(
    name = "mdc-autocomplete",
    srcs = glob(
        ["**/*.ts"],
        exclude = [
            "**/*.spec.ts",
        ],
    ),
    assets = [
        ":autocomplete_scss",
    ] + glob(["**/*.html"]),
    module_name = "@angular/material-experimental/mdc-autocomplete",
    deps = [
        "//src/cdk/overlay",
        "//src/cdk/scrolling",
        "//src/material-experimental/mdc-core",
        "//src/material/autocomplete",
        "@npm//@angular/common",
    ],
)

sass_library(
    name = "mdc_autocomplete_scss_lib",
    srcs = glob(["**/_*.scss"]),
    deps = [
        "//src/material-experimental/mdc-helpers:mdc_helpers_scss_lib",
        "//src/material-experimental/mdc-helpers:mdc_scss_deps_lib",
    ],
)

sass_binary(
    name = "autocomplete_scss",
    src = "autocomplete.scss",
    include_paths = [
        "external/npm/node_modules",
    ],
    deps = [
        "//src/material-experimental/mdc-helpers:mdc_helpers_scss_lib",
        "//src/material-experimental/mdc-helpers:mdc_scss_deps_lib",
        "//src/material/core:core_scss_lib",
    ],
)

ng_test_library(
    name = "mdc_autocomplete_tests_lib",
    srcs = glob(
        ["**/*.spec.ts"],
        exclude = [
            "**/*.e2e.spec.ts",
        ],
    ),
    deps = [
        ":mdc-autocomplete",
        "//src/cdk/bidi",
        "//src/cdk/keycodes",
        "//src/cdk/overlay",
        "//src/cdk/platform",
        "//src/cdk/scrolling",
        "//src/cdk/testing/private",
        "//src/material-experimental/mdc-core",
        "//src/material-experimental/mdc-form-field",
        "//src/material-experimental/mdc-input",
        "@npm//@angular/forms",
        "@npm//@angular/platform-browser",
        "@npm//rxjs",
    ],
)

ng_web_test_suite(
    name = "unit_tests",
    static_files = [
        "@npm//:node_modules/@material/textfield/dist/mdc.textfield.js",
        "@npm//:node_modules/@material/line-ripple/dist/mdc.lineRipple.js",
        "@npm//:node_modules/@material/notched-outline/dist/mdc.notchedOutline.js",
        "@npm//:node_modules/@material/dom/dist/mdc.dom.js",
    ],
    deps = [
        ":mdc_autocomplete_tests_lib",
        "//src/material-experimental:mdc_require_config.js",
    ],
)
